package ldkxingzhe.l365calendar.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.baidu.location.BDLocation;

/**
 * 定位实体
 * Created by xingzhe on 16/2/2.
 */
public class LocationEntity implements Parcelable{
    private int _id;
    private long created;
    private double latitude;
    private double longitude;
    private int locType;
    private float radius;
    private String coorType;
    private String province;
    private String street;
    private String locationDescribe;
    private String district;

    public LocationEntity(){}
    public LocationEntity(BDLocation bdLocation){
        latitude = bdLocation.getLatitude();
        longitude = bdLocation.getLongitude();
        locType = bdLocation.getLocType();
        radius = bdLocation.getRadius();
        coorType = bdLocation.getCoorType();
        province = bdLocation.getProvince();
        street = bdLocation.getStreet();
        locationDescribe = bdLocation.getLocationDescribe();
        district = bdLocation.getDistrict();
    }

    public LocationEntity(BDLocation bdLocation, long created){
        this(bdLocation);
        this.created = created;
    }

    protected LocationEntity(Parcel in) {
        _id = in.readInt();
        created = in.readLong();
        latitude = in.readDouble();
        longitude = in.readDouble();
        locType = in.readInt();
        radius = in.readFloat();
        coorType = in.readString();
        province = in.readString();
        street = in.readString();
        locationDescribe = in.readString();
    }

    public static final Creator<LocationEntity> CREATOR = new Creator<LocationEntity>() {
        @Override
        public LocationEntity createFromParcel(Parcel in) {
            return new LocationEntity(in);
        }

        @Override
        public LocationEntity[] newArray(int size) {
            return new LocationEntity[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(_id);
        dest.writeLong(created);
        dest.writeDouble(latitude);
        dest.writeDouble(longitude);
        dest.writeInt(locType);
        dest.writeFloat(radius);
        dest.writeString(coorType);
        dest.writeString(province);
        dest.writeString(street);
        dest.writeString(locationDescribe);
    }



    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public long getCreated() {
        return created;
    }

    public void setCreated(long created) {
        this.created = created;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public int getLocType() {
        return locType;
    }

    public void setLocType(int locType) {
        this.locType = locType;
    }

    public float getRadius() {
        return radius;
    }

    public void setRadius(float radius) {
        this.radius = radius;
    }

    public String getCoorType() {
        return coorType;
    }

    public void setCoorType(String coorType) {
        this.coorType = coorType;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getLocationDescribe() {
        return locationDescribe;
    }

    public void setLocationDescribe(String locationDescribe) {
        this.locationDescribe = locationDescribe;
    }
    public String getDistrict() {
        return district;
    }

    public void setDistrict(String district) {
        this.district = district;
    }
}
